package com.cci.kangdao.controller;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.cci.kangdao.aop.annotation.NoDuplicateSubmission;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.cci.kangdao.service.WorkOrderCommTService;
import com.cci.kangdao.utilTool.ParameterTool;
/**
 * 用户App评价
 *
 */
@Controller
public class WorkOrderCommTController {
	
	private Logger log = Logger.getLogger(this.getClass().getName());
	
	@Autowired
	private WorkOrderCommTService workOrderCommTService;
	/**
	 * 用户app评价功能
	 * @param map
	 * @return
	 */
    @NoDuplicateSubmission
    @RequestMapping("/userAPPAppraise.aspx")
    public ModelAndView getServiceChannelByServiceStationId(HttpServletRequest request,
                                                            HttpServletResponse response) throws Exception {
		try{
			Map<String, Object> map = ParameterTool.getParameterRequest(request, true);
			map.put("response", response);
			map.put("request", request);
			return workOrderCommTService.userAPPAppraise(map);
		}catch(Exception ex){
			log.error(ex.getMessage(),ex);	
			
			String msg = "{\"status\": -99,\"msg\": \"未知错误\"}";
			ParameterTool.writeResponse(response, msg);	
		}
		return null;
	}


	//根据工单id获取用户评价信息
	@RequestMapping("/userAppraiseMsg.aspx")
	public ModelAndView userAppraiseMsg(HttpServletRequest request,
															HttpServletResponse response) throws Exception {
		try{
			Map<String, Object> map = ParameterTool.getParameterRequest(request, true);
			map.put("response", response);
			map.put("request", request);
			return workOrderCommTService.userAppraiseMsg(map);
		}catch(Exception ex){
			log.error(ex.getMessage(),ex);

			String msg = "{\"status\": -99,\"msg\": \"未知错误\"}";
			ParameterTool.writeResponse(response, msg);
		}
		return null;
	}



	//ccec用户评价接口
    @NoDuplicateSubmission
    @RequestMapping("/userAPPAppraiseForCCEC.aspx")
    public ModelAndView userAPPAppraiseForCCEC(HttpServletRequest request,
                                               HttpServletResponse response) throws Exception {
		try{
			Map<String, Object> map = ParameterTool.getParameterRequest(request, true);
			map.put("response", response);
			map.put("request", request);
			return workOrderCommTService.userAPPAppraiseForCCEC(map);
		}catch(Exception ex){
			log.error(ex.getMessage(),ex);

			String msg = "{\"status\": -99,\"msg\": \"未知错误\"}";
			ParameterTool.writeResponse(response, msg);
		}
		return null;
	}
}
